package com.neusoft.yiyang.diet.service.impl;

import com.neusoft.yiyang.common.entity.diet.DietTag;
import com.neusoft.yiyang.diet.mapper.DietTagMapper;
import com.neusoft.yiyang.diet.service.DietTagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DietTagServiceImpl implements DietTagService {

    @Autowired
    private DietTagMapper dietTagMapper;

    @Override
    public void addDietTag(DietTag dietTag) {
        dietTagMapper.insert(dietTag);
    }

    @Override
    public List<DietTag> getAllDietTags() {
        return dietTagMapper.selectList(null);
    }

    @Override
    public DietTag getDietTagById(Integer tagId) {
        return dietTagMapper.selectById(tagId);
    }

    @Override
    public void updateDietTag(DietTag dietTag) {
        dietTagMapper.updateById(dietTag);
    }

    @Override
    public void deleteDietTag(Integer tagId) {
        dietTagMapper.deleteById(tagId);
    }
}
